<?php $header = GLOBALS('header');
$conf= GLOBALS('conf');
$user = GLOBALS('user');
$gid = GLOBALS('gid');
isset($user['avatar_url']) || $user['avatar_url'] = '';
$menu = GLOBALS('menu');
$forumlist_show = GLOBALS('forumlist_show');
$route = GLOBALS('route');
$action = GLOBALS('action');
$config = GLOBALS('config');
$static_version = $conf['static_version'];
?>
<!DOCTYPE html>
<html lang="<?php echo $conf['lang'];?>">
<head>

    <!--{hook admin_header_meta_before.htm}-->

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no" />
    <meta name="renderer" content="webkit" />
    <meta name="referrer" content="no-referrer">
    <meta name="applicable-device" content="pc,mobile" />
    <meta name="MobileOptimized" content="width" />
    <meta name="HandheldFriendly" content="true" />
    <meta name="author" content="WellCMS.cn" />
    <meta name="keywords" content="<?php echo strip_tags($header['keywords']);?>" />
    <meta name="description" content="<?php echo strip_tags($header['description']);?>" />
    <title><?php echo $header['title'];?> - WellCMS</title>
    <link rel="shortcut icon" href="../view/img/favicon.ico" />
    <link rel="icon" sizes="32x32" href="../view/img/favicon.ico">
    <link rel="Bookmark" href="../view/img/favicon.ico" />

    <!--{hook admin_header_css_start.htm}-->

    <link rel="stylesheet" href="<?php echo admin_view_path();?>css/bootstrap.min.css<?php echo $static_version;?>">
    <!--{hook admin_header_css_before.htm}-->
    <link rel="stylesheet" href="<?php echo admin_view_path();?>css/font-awesome.min.css<?php echo $static_version;?>">
    <!--{hook admin_header_css_after.htm}-->
    <link rel="stylesheet" href="<?php echo admin_view_path();?>css/wellcms_x.css<?php echo $static_version;?>">
    <!--{hook admin_header_css_end.htm}-->
</head>

<body>

<!--{hook admin_header_start.htm}-->

<header class="navbar fixed-top navbar-expand-lg <?php if ('login'==$action) {echo 'navbar-dark bg-dark-blue';} ?>">
    <!-- 左：折叠菜单的图标 ☰ -->
    <button class="navbar-toggler ml-2" type="button" data-toggle="collapse" data-target="#nav" aria-controls="navbar_collapse" aria-expanded="false" aria-label="<?php echo lang('toggler_menu');?>">
        <span class="navbar-toggler-icon"></span>
    </button>

    <!-- LOGO -->
    <div class="navbar-brand col-2 hidden-lg hidden-xl">
        <img class="logo-2 mx-auto d-block" src="../view/img/logo.png">
    </div>
    <div class="navbar-brand col-2 hidden-md hidden-sm mr-0" style="max-width: 240px;">
        <img class="logo-2 mx-auto d-block" src="../view/img/admin.logo.png">
    </div>

    <!--- index page --->
    <a class="navbar-brand d-md-none" href="../" title="<?php echo lang('front_index_page');?>"><i class="icon-home"></i></a>

    <!--{hook admin_header_logo_after.htm}-->
    <div class="collapse navbar-collapse py-1 <?php if ('login' != $action) {echo 'navbar-light bg-light border-bottom';} ?>">
        <!-- right -->
        <ul class="navbar-nav ml-auto">
            <!--{hook admin_header_user_start.htm}-->
            <li class="nav-item">
                <a class="nav-link" href="<?php echo url_path(),url('my', '', 2);?>">
                    <img class="avatar-1 mr-1" src="<?php echo $user['avatar_url'];?>">&nbsp;<?php echo isset($user['username']) ? $user['username'] : '';?>
                </a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="../"><i class="icon-home"></i>&nbsp;<?php echo lang('front_index_page');?></a>
            </li>
            <li class="nav-item">
                <a class="nav-link" href="<?php echo url('index-logout', '', TRUE);?>"><i class="icon-sign-out"></i>&nbsp;<?php echo lang('logout');?></a>
            </li>

            <!--{hook admin_header_user_end.htm}-->
        </ul>
    </div>
</header>

<!--{hook admin_header_end.htm}-->
<main id="body">
    <div class="container-fluid">
        <div class="row">
            <?php if ('login' != $action) { ?>
            <nav id="nav" class="admin-nav collapse navbar-collapse col-lg-2 d-lg-block navbar-expand-lg navbar-dark bg-dark-blue sidebar" style="z-index: 1020;">
                <div class="sidebar-sticky" id="wellcms-nav">
                    <!--{hook admin_header_nav_start.htm}-->
                    <ul class="navbar-nav flex-column">
                        <li class="nav-item home">
                            <a class="nav-link" href="<?php echo $conf['url_rewrite_on']>1 ? '/admin/' : './';?>">
                                <div class="menu-icon">
                                    <i class="icon-home"></i>
                                </div>
                                &nbsp;<?php echo lang('admin_index_page');?></a>
                        </li>
                        <?php if (1 == $gid){ ?>
                        <li class="nav-item upgrade">
                            <a class="nav-link" href="<?php echo url('other-upgrade', '', TRUE);?>">
                                <div class="menu-icon">
                                    <i class="icon-cloud-upload <?php if(array_value($config, 'upgrade', 0)){echo 'text-danger';}?>"></i>
                                </div>
                                &nbsp;<?php echo lang('online_upgrade');?></a>
                        </li>
                        <?php } ?>
                        <!--{hook admin_header_nav_before.htm}-->
                        <?php foreach ($menu as $k=>$v) { ?>
                        <li class="nav-item nav-item-<?php echo $k;?>">
                            <a class="nav-link" data-toggle="collapse" data-target="#<?php echo $k;?>" aria-expanded="false" aria-controls="collapse" href="javascript:void(0);">
                                <div class="menu-icon">
                                    <i class="<?php echo $v['icon'];?>"></i>
                                </div>
                                &nbsp;<?php echo $v['text'];?></a>
                            <div id="<?php echo $k;?>" class="collapse bg-dark" aria-labelledby="heading" data-parent="#wellcms-nav">
                                <ul class="navbar-nav flex-column">
                                    <?php foreach ($v['tab'] as $key=>$val) { ?>
                                    <li class="nav-item menu-<?php echo $key;?>">
                                        <a class="nav-link text-white pl-5" href="<?php echo $val['url'];?>">
                                            <i class="icon-angle-double-right"></i>
                                            &nbsp;<?php echo $val['text'];?>
                                        </a>
                                    </li>
                                    <?php  } ?>
                                </ul>
                            </div>
                        </li>
                        <?php  } ?>
                        <!--{hook admin_header_nav_after.htm}-->
                        <!--以下代码无需改动-->
                        <li class="nav-item d-flex justify-content-between d-md-none">
                            <a class="nav-link" href="<?php echo url_path(),url('my', '', 2);?>">
                                <img class="avatar-1 mr-1" src="<?php echo $user['avatar_url'];?>">&nbsp;<?php echo isset($user['username']) ? $user['username'] : '';?>
                            </a>
                            <a class="nav-link" href="<?php echo url('index-logout', '', TRUE);?>"><i class="icon-sign-out"></i>&nbsp;<?php echo lang('logout');?></a>
                        </li>
                    </ul>
                    <!--{hook admin_header_nav_end.htm}-->
                </div>
            </nav>
            <?php } ?>

            <div role="main" class="<?php if ('login'==$action) {echo 'col-md-12';} else {echo 'admin-content';} ?>">